package com.proyecto.core.vista.echo.componentes;

import java.util.Date;
import java.util.EventListener;
import java.util.ResourceBundle;
import nextapp.echo2.app.WindowPane;
import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.app.ContentPane;
import nextapp.echo2.app.Column;

import com.proyecto.core.Utilidades.ObtenerFecha;
import com.proyecto.core.modelo.echo.constantes.ParametrosIniciales;
import com.proyecto.core.vista.echo.componentes.RwHora;
import nextapp.echo2.app.Row;
import nextapp.echo2.app.Button;
import nextapp.echo2.app.ResourceImageReference;
import nextapp.echo2.app.Alignment;
import nextapp.echo2.app.layout.RowLayoutData;
import nextapp.echo2.app.Insets;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.event.ActionListener;
import nextapp.echo2.app.event.ActionEvent;
import nextapp.echo2.app.layout.ColumnLayoutData;

public class WpHora extends WindowPane {

	private ResourceBundle resourceBundle;
	private RwHora rwHora1;

	/**
	 * Creates a new <code>WpHora</code>.
	 */
	public WpHora() {
		super();

		// Add design-time configured components.
		initComponents();
		this.setModal(true);
		this.setResizable(false);
		this.setClosable(false);
	}

	private void CapturarHora(ActionEvent e) {
		//TODO Implement.
	    getParent().remove(WpHora.this);
	    EventListener listener = getEventListenerList().getListeners(ActionListener.class)[0];
	    ActionEvent outgoingEvent = new ActionEvent(this, rwHora1.getDatoHora());
	    ((ActionListener) listener).actionPerformed(outgoingEvent);
	}

	public void addActionListener(ActionListener l) {
        getEventListenerList().addListener(ActionListener.class, l);
    }

	/**
	 * Configures initial state of component.
	 * WARNING: AUTO-GENERATED METHOD.
	 * Contents will be overwritten.
	 */
	private void initComponents() {
		resourceBundle = ResourceBundle.getBundle(
				"com.proyecto.core.vista.echo.resource.localization.etiquetas",
				ApplicationInstance.getActive().getLocale());
		this.setWidth(new Extent(300, Extent.PX));
		this.setResizable(false);
		this.setHeight(new Extent(120, Extent.PX));
		this.setStyleName("DefaultWPHora");
		ContentPane contentPane1 = new ContentPane();
		add(contentPane1);
		Column column1 = new Column();
		column1
				.setInsets(new Insets(new Extent(10, Extent.PX), new Extent(10,
						Extent.PX), new Extent(0, Extent.PX), new Extent(0,
						Extent.PX)));
		contentPane1.add(column1);
		rwHora1 = new RwHora();
		rwHora1
				.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
		column1.add(rwHora1);
		Row row2 = new Row();
		row2.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
		ColumnLayoutData row2LayoutData = new ColumnLayoutData();
		row2LayoutData.setInsets(new Insets(new Extent(0, Extent.PX),
				new Extent(5, Extent.PX), new Extent(0, Extent.PX), new Extent(
						0, Extent.PX)));
		row2.setLayoutData(row2LayoutData);
		column1.add(row2);
		Button button1 = new Button();
		button1.setText(resourceBundle
				.getString("CoreVista.base.RowBotonera.Aceptar"));
		ResourceImageReference imageReference1 = new ResourceImageReference(
				"/com/proyecto/core/vista/echo/resource/image/icon/general/Iconos/accept.png");
		button1.setIcon(imageReference1);
		button1
				.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
		button1.setToolTipText(resourceBundle
				.getString("CoreVista.base.RowBotonera.Aceptar"));
		button1.setStyleName("2OpenLabs.Button.Transaccion");
		RowLayoutData button1LayoutData = new RowLayoutData();
		button1LayoutData.setInsets(new Insets(new Extent(20, Extent.PX),
				new Extent(0, Extent.PX)));
		button1.setLayoutData(button1LayoutData);
		button1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CapturarHora(e);
			}
		});
		row2.add(button1);
	}
}
